﻿//-----------------------------------------------------------------------
// <copyright file="HomeScreen.cs" company="FCIS">
//     Company copyright tag.
// </copyright>
// <author>Ramy Medhat</author>
// <date>24/8/2011</date>
// <reviewer></reviewer>
//-----------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using FCISPlus.Server;
using FCISPlus.Server.Communicator;

namespace FCISPlus
{
    /// <summary>
    /// The FCIS+ Home Screen window.
    /// </summary>
    public partial class HomeScreen : Form
    {
        /// <summary>
        /// Instance of the server communicator.
        /// </summary>
        private IFCISPlusServerCommunicator communicator;

        /// <summary>
        /// Initializes a new instance of the <see cref="HomeScreen"/> class.
        /// </summary>
        public HomeScreen()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Handles the Click event of the btnToggleServer control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnToggleServer_Click(object sender, EventArgs e)
        {
            if (this.communicator == null)
            {
                this.communicator = FCISPlusServerFactory.GetCommunicator();
                this.btnToggleServer.Text = "Stop Server";
            }
            else
            {
                this.communicator = null;
                this.btnToggleServer.Text = "Start Server";
            }
        }

        /// <summary>
        /// Handles the Click event of the btnNewClient control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void btnNewClient_Click(object sender, EventArgs e)
        {
            Client.UI.ClientHome client = new Client.UI.ClientHome();
            client.Show();
        }
    }
}
